#include<bits/stdc++.h>
using namespace std;
#define xyf main
typedef long long LL;
#define maxn 101
#define maxnum 100010

inline int read()
{
	int f=1,x=0;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int num[maxnum],dp[maxnum],a[maxn];
bool judge[maxn];
int total,n;
int xyf()
{
	total=read();
	n=read();
	for(int i=1;i<=n;++i)
		a[i]=read();
	dp[0]=1;
	for(int i=1;i<=n;++i)
		for(int j=total;j>=a[i];--j)
			if(dp[j-a[i]])
			{
				dp[j]+=dp[j-a[i]];
				if(!num[j])
					num[j]=i;
			}
	if(dp[total]==0)
		return cout<<0<<endl,0;
	if(dp[total]>1)
		return cout<<-1,0;
	for(int i=total;i>0;i-=a[num[i]])
		judge[num[i]]=true;
	for(int i=1;i<=n;++i)
		if(!judge[i])
			cout<<i<<' ';
	return 0;
}
